/**
 * 2025/01/01 - 2025/12/31
 */
package com.snail.starter.utils.rest;

import lombok.Data;
import lombok.ToString;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;

/**
 *
 * @author zgadmin
 * @date 2025/7/23 16:11
 *
 */
@Data
@ToString
public class HttpContext<REQ, RES> {

    private String url;

    private HttpMethod httpMethod;

    private HttpEntity<REQ> httpEntity;

    private ParameterizedTypeReference<RES> responseType;

    private Object[] uriVariables;

    public HttpContext(){}

    public HttpContext(String url, HttpMethod httpMethod, HttpEntity<REQ> httpEntity, ParameterizedTypeReference<RES> responseType, Object[] uriVariables){
        this.url = url;
        this.httpMethod = httpMethod;
        this.httpEntity = httpEntity;
        this.responseType = responseType;
        this.uriVariables = uriVariables;
    }

    public static <REQ, RES> HttpContext<REQ, RES> of(String url, HttpMethod httpMethod, HttpEntity<REQ> httpEntity, ParameterizedTypeReference<RES> responseType, Object[] uriVariables){
        return new HttpContext<>(url, httpMethod, httpEntity, responseType, uriVariables);
    }

}